package shellstation;

import javax.swing.*;
import javax.swing.event.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.JFrame;

public class ReportView implements ActionListener {
    private int user=0;
    private JFrame frame;

    private JButton prodPerfButton;
    private JButton inventoryButton;
    private JButton backButton;

    private JPanel panel;
    private JPanel panel2;
    private JPanel bluePanel;

    private JLabel reportFacility;

    private Color yellow = new Color(255, 218, 63);
    private Color gray = new Color(182, 182, 182);
    private Color red = new Color(226, 0, 0);
    private Color blue = new Color(62, 142, 169);

    public void ReportView(){

        frame = new JFrame("Shell Station - Inventroy Sales System");
        frame.setSize(750, 450);
        frame.setVisible(true);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setResizable(false);

        prodPerfButton = new JButton("Product Performance Report");
        prodPerfButton.setBackground(gray);
        prodPerfButton.setBounds(18, 25, 250, 75);
        prodPerfButton.setFont(new Font("Arial", Font.BOLD, 15));
        prodPerfButton.addActionListener(this);

        inventoryButton= new JButton("Inventory Report");
        inventoryButton.setBackground(gray);
        inventoryButton.setBounds(18, 115, 250, 75);
        inventoryButton.setFont(new Font("Arial", Font.BOLD, 25));
        inventoryButton.addActionListener(this);

        bluePanel= new JPanel(null);
        bluePanel.setBounds(55, 25, 350, 75);
        bluePanel.setBackground(blue);

        reportFacility = new JLabel("Report Facilities");
        reportFacility.setFont(new Font("Hobo Std", Font.BOLD, 28));
        reportFacility.setBounds(70, 20, 225, 50);

        bluePanel.add(reportFacility);

        backButton = new JButton("Back");
        backButton.setBackground(gray);
        backButton.setBounds(18, 215, 250, 75);
        backButton.setFont(new Font("Arial", Font.BOLD, 35));
        backButton.addActionListener(this);

        panel = new JPanel(null);
        panel.setBackground(red);

        panel2= new JPanel(null);
        panel2.setBounds(300, 0, 750, 424);
        panel2.setBackground(yellow);

        panel.add(prodPerfButton);
        panel.add(inventoryButton);
        panel.add(backButton);

        panel2.add(bluePanel);

        panel.add(panel2);
        frame.add(panel);
    }

    public void actionPerformed(ActionEvent e){

        if(e.getSource() == backButton){

            frame.dispose();

            MainMenu m= new MainMenu();
            m.MainMenu();
            m.getuser(this.user);
        }
        else if(e.getSource() == prodPerfButton)
        {

        
            PerformanceView1 p= new PerformanceView1();
            p.PerformanceView();
            p.getuser(this.user);
        }

        else if(e.getSource() == inventoryButton)
        {


            InventoryReportView i = new InventoryReportView();
           i.InventoryReportView();
          
        }

    }
    public void getuser(int u){
        this.user = u;
    }


}
